import { DatabaseType } from '@/lib/domain/database-type';
import type { Template } from '../templates-data';
import image from '@/assets/templates/django-axes-db.png';
import imageDark from '@/assets/templates/django-axes-db-dark.png';

export const djangoAxesDb: Template = {
    slug: 'django-axes-database',
    name: 'Django-Axes',
    shortDescription: 'Keep track of failed login attempts',
    description:
        'Plugin for keeping track of suspicious login attempts for your Django based website and implementing simple brute-force attack blocking.',
    image,
    imageDark,
    tags: ['Postgres', 'Python', 'Django'],
    featured: true,
    url: 'https://github.com/',
    diagram: {
        id: 'django_axes_db',
        name: 'django-axes-database',
        createdAt: new Date(),
        updatedAt: new Date(),
        databaseType: DatabaseType.POSTGRESQL,
        tables: [
            {
                id: '4esk76ris823wds5xm9bconsh',
                name: 'axes_accessattempt',
                schema: 'public',
                x: 100,
                y: 100,
                fields: [
                    {
                        id: 'qiifgo2m69wr2f5r540ighdn5',
                        name: 'id',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: true,
                        unique: true,
                        nullable: false,
                        createdAt: Date.now(),
                    },
                    {
                        id: '66cz3gwbtp76bdcwt0h7yd59o',
                        name: 'user_agent',
                        type: {
                            id: 'character_varying',
                            name: 'character varying',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: Date.now(),
                    },
                    {
                        id: '7x8xnt3d6tvg8ypgutg69ezwf',
                        name: 'ip_address',
                        type: {
                            id: 'character',
                            name: 'character',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: Date.now(),
                    },
                    {
                        id: '4uzrfehffgkko23kkfnem845e',
                        name: 'username',
                        type: {
                            id: 'character_varying',
                            name: 'character varying',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: Date.now(),
                    },
                    {
                        id: 'em88cnmugu1hbz2eoitw0pg41',
                        name: 'http_accept',
                        type: {
                            id: 'character_varying',
                            name: 'character varying',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: Date.now(),
                    },
                    {
                        id: 'r3ci7zx7hpqfjl7xh901o26t0',
                        name: 'path_info',
                        type: {
                            id: 'character_varying',
                            name: 'character varying',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: Date.now(),
                    },
                    {
                        id: 'x7gp2rhiyeuxfo9z7do6m8jx5',
                        name: 'attempt_time',
                        type: {
                            id: 'timestamp_without_time_zone',
                            name: 'timestamp without time zone',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: Date.now(),
                    },
                    {
                        id: '5kr5n4kw3yj9zyrdzge1dmmel',
                        name: 'get_data',
                        type: {
                            id: 'text',
                            name: 'text',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: Date.now(),
                    },
                    {
                        id: 'w9ftgbg7eageinlswv81236i6',
                        name: 'post_data',
                        type: {
                            id: 'text',
                            name: 'text',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: Date.now(),
                    },
                    {
                        id: '1uzevngyjshchz6ng4pminmn6',
                        name: 'failures_since_start',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: Date.now(),
                    },
                ],
                indexes: [
                    {
                        id: '5cwoxgz8yfnk04sdwsxkzkrzz',
                        name: 'axes_accessattempt_pkey',
                        unique: true,
                        fieldIds: ['qiifgo2m69wr2f5r540ighdn5'],
                        createdAt: Date.now(),
                    },
                    {
                        id: 'atwekklt473ufr376hwecjmto',
                        name: 'axes_accessattempt_ip_address_index',
                        unique: false,
                        fieldIds: ['7x8xnt3d6tvg8ypgutg69ezwf'],
                        createdAt: Date.now(),
                    },
                    {
                        id: '392z7orwsld9pvus25g0o9x7q',
                        name: 'axes_accessattempt_username_index',
                        unique: false,
                        fieldIds: ['4uzrfehffgkko23kkfnem845e'],
                        createdAt: Date.now(),
                    },
                    {
                        id: 'dl7hqeogexegty5n8mthkd42t',
                        name: 'axes_accessattempt_user_agent_index',
                        unique: false,
                        fieldIds: ['66cz3gwbtp76bdcwt0h7yd59o'],
                        createdAt: Date.now(),
                    },
                ],
                color: '#8eb7ff',
                isView: false,
                isMaterializedView: false,
                createdAt: Date.now(),
            },
            {
                id: 'knudgan04alr6isbtj71hrp4o',
                name: 'axes_accesslog',
                schema: 'public',
                x: 500,
                y: 100,
                fields: [
                    {
                        id: 'gb0jb6h526ovyigq59hasphe9',
                        name: 'id',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: true,
                        unique: true,
                        nullable: false,
                        createdAt: Date.now(),
                    },
                    {
                        id: 'h646hkm3f7l44e7636t1vy36k',
                        name: 'user_agent',
                        type: {
                            id: 'character_varying',
                            name: 'character varying',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: Date.now(),
                    },
                    {
                        id: '8d4thw73t977q0urpsz9kb756',
                        name: 'ip_address',
                        type: {
                            id: 'character',
                            name: 'character',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: Date.now(),
                    },
                    {
                        id: '81tx841qnh0w0aivsi80zlwnj',
                        name: 'username',
                        type: {
                            id: 'character_varying',
                            name: 'character varying',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: Date.now(),
                    },
                    {
                        id: 'iznj6y8lya85cxmbflx1php3k',
                        name: 'http_accept',
                        type: {
                            id: 'character_varying',
                            name: 'character varying',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: Date.now(),
                    },
                    {
                        id: 'tes78cloyrabu6qcqx4uydc11',
                        name: 'path_info',
                        type: {
                            id: 'character_varying',
                            name: 'character varying',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: Date.now(),
                    },
                    {
                        id: 'l9bfkhgnydp27ijjcmt8pivdw',
                        name: 'attempt_time',
                        type: {
                            id: 'timestamp_without_time_zone',
                            name: 'timestamp without time zone',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: Date.now(),
                    },
                    {
                        id: 'i98mn16tjtmrbkmiddnm6al1g',
                        name: 'logout_time',
                        type: {
                            id: 'timestamp_without_time_zone',
                            name: 'timestamp without time zone',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: Date.now(),
                    },
                ],
                indexes: [
                    {
                        id: '71pclulmgkm9cupzfefeevqs9',
                        name: 'axes_accesslog_user_agent_index',
                        unique: false,
                        fieldIds: ['h646hkm3f7l44e7636t1vy36k'],
                        createdAt: Date.now(),
                    },
                    {
                        id: 'm2e0wcfv78sbu0tuqr54ewlh2',
                        name: 'axes_accesslog_pkey',
                        unique: true,
                        fieldIds: ['gb0jb6h526ovyigq59hasphe9'],
                        createdAt: Date.now(),
                    },
                    {
                        id: '0rcy8x74jr39osxh727jjnkj3',
                        name: 'axes_accesslog_username_index',
                        unique: false,
                        fieldIds: ['81tx841qnh0w0aivsi80zlwnj'],
                        createdAt: Date.now(),
                    },
                    {
                        id: 'fyq3q7zy49bcehsh236skz9ah',
                        name: 'axes_accesslog_ip_address_index',
                        unique: false,
                        fieldIds: ['8d4thw73t977q0urpsz9kb756'],
                        createdAt: Date.now(),
                    },
                ],
                color: '#8eb7ff',
                isView: false,
                isMaterializedView: false,
                createdAt: Date.now(),
            },
        ],
        relationships: [],
        dependencies: [],
    },
};
